from selenium import webdriver
import pytest
from selenium.webdriver.common.by import By

from .Input import Input


def test_ant_input():
    browser = webdriver.Chrome()
    browser.maximize_window()
    browser.get("https://3x.ant.design/components/input-cn/")
    try:
        input = Input(browser, '//section[@id="components-input-demo-basic"]/section/input', By.XPATH)
        input.setValue("123455")
    finally:
        browser.close()

def test_ant_input_number():
    browser = webdriver.Chrome()
    browser.maximize_window()
    browser.get("https://3x.ant.design/components/input-number-cn/")
    try:
        input = Input(browser, '//section[@id="components-input-number-demo-basic"]/section//input[@role="spinbutton"]', By.XPATH)
        input.setValue("9")
    finally:
        browser.close()

def test__input_fish_clear():
    browser = webdriver.Chrome()
    browser.maximize_window()
    browser.get("https://fish.iwhalecloud.com/fish-desktop/examples/clearinput/index.html")
    try:
        input = Input(browser, 'clearable', By.ID)
        input.setValue("hello world")
    finally:
        browser.close()
